﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ESRI.ArcGIS.Client.Geometry;

namespace GISforTT_API
{
    // TODO-VAR: This class should be able to manage the bookmark list + read them initially from an xml file and serialize them in this file
    public class BookmarkList
    {

        private List<Bookmark> bookmarks;
        
        /// <summary>
        /// Returns the instance of the BookmarkList singleton class
        /// </summary>
        public static BookmarkList Instance { get; private set; }

        static BookmarkList() { Instance = new BookmarkList(); }
        
        // Private Constructor
        BookmarkList()
        {
            bookmarks = new List<Bookmark>();
        }

        /*
        private void createSampleBookmarkList()
        {
            bookmarks = new List<Bookmark>();

            //Envelope mEnv1 = new Envelope(-114.165225251302, 51.0199795790397, -114.149512923988, 51.0355755135701);
            //Bookmark tt1 = new Bookmark(mEnv1, "Out of order lights", "0006780", Bookmark.BookmarkPriority.High);
            //bookmarks.Add(tt1);

            //Envelope mEnv2 = new Envelope(-114.146822616181, 51.1247138317455, -114.12585847052, 51.1364297207226);
            //Bookmark tt2 = new Bookmark(mEnv2, "Repair Transformer", "0006889", Bookmark.BookmarkPriority.Medium);
            //bookmarks.Add(tt2);            
        }*/

        /// <summary>
        /// Initialize the Bookmark list to the specified list
        /// </summary>
        /// <param name="bks">List of Bookmark Objects</param>
        public void initializeBookmarkList(List<Bookmark> bks)
        {
            if (bks == null)
                return;

            bookmarks.Clear();

            foreach (Bookmark b in bks)
                bookmarks.Add(b);
        }
        
        /// <summary>
        /// Returns the List of Bookmark objects
        /// </summary>
        /// <returns></returns>
        public List<Bookmark> getBookmarks()
        {
            return bookmarks;
        }

    }
}
